<?xml version="1.0" encoding="UTF-8"?>
<jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:ui="http://www.sun.com/web/ui">
    <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
    <f:view>
        <ui:page binding="#{variablesBalance.page1}" id="page1">
            <ui:html binding="#{variablesBalance.html1}" id="html1">
                <ui:head binding="#{variablesBalance.head1}" id="head1">
                    <ui:link binding="#{variablesBalance.link1}" id="link1" url="/resources/stylesheet.css"/>
                    <!--<ui:meta content="10" httpEquiv="Refresh"/>-->
                </ui:head>
                <ui:body binding="#{variablesBalance.body1}" id="body1" style="-rave-layout: grid">
                    <ui:form binding="#{variablesBalance.form1}" id="form1">
                        <h:panelGrid binding="#{variablesBalance.gridPanel2}" id="gridPanel2" style="height: 240px; left: 31px; top: 141px; position: absolute" width="859">
                            <ui:alert binding="#{variablesBalance.alert1}" id="alert1"/>
                            <ui:table binding="#{variablesBalance.table1}" id="table1" paginateButton="true" paginationControls="true"
                                title="Variables Estado Financero" width="909">
                                <script><![CDATA[
                                
                                function espacios(campo, event){
                                    cadenaReemplazar= " ";
                                    valorReemplazo="";
                                    cadena = campo.value;
                                    cadenaNueva = cadena.split(cadenaReemplazar).join(valorReemplazo);
                                    campo.value = cadenaNueva;                                
                                }
/* ----- Functions for Table Preferences Panel ----- */
/*
 * Toggle the table preferences panel open or closed
 */
function togglePreferencesPanel() {
  var table = document.getElementById("form1:table1");
  table.toggleTblePreferencesPanel();
}
/* ----- Functions for Filter Panel ----- */
/*
 * Return true if the filter menu has actually changed,
 * so the corresponding event should be allowed to continue.
 */
function filterMenuChanged() {
  var table = document.getElementById("form1:table1");
  return table.filterMenuChanged();
}
/*
 * Toggle the custom filter panel (if any) open or closed.
 */
function toggleFilterPanel() {
  var table = document.getElementById("form1:table1");
  return table.toggleTableFilterPanel();
}
/* ----- Functions for Table Actions ----- */
/*
 * Initialize all rows of the table when the state
 * of selected rows changes.
 */
function initAllRows() {
  var table = document.getElementById("form1:table1");
  table.initAllRows();
}
/*
 * Set the selected state for the given row groups
 * displayed in the table.  This functionality requires
 * the 'selectId' of the tableColumn to be set.
 *
 * @param rowGroupId HTML element id of the tableRowGroup component
 * @param selected Flag indicating whether components should be selected
 */
function selectGroupRows(rowGroupId, selected) {
  var table = document.getElementById("form1:table1");
  table.selectGroupRows(rowGroupId, selected);
}

/* funciones realizadas para controlar acciones */

function busqueda(){
     var campo= document.getElementById('form1:hiddenField1');     
     var valor = window.prompt("Digite el valor de la Variable que desea buscar. \n¡Deje en blanco para mostrar todos los registros!");
     if(valor!=null){
        campo.value = valor;     
     }else{                        
        return null;        
     }        
}

function valores(codigo,descripcion){
    var objecto = document.getElementById("form1:table1:txtCodigo");
    var objecto1 = document.getElementById("form1:table1:txtDescripcion");   
    objecto.value=codigo;
    objecto1.value=descripcion;    
     //setTimeout("return true;",1000);
}

/*
 * Disable all table actions if no rows have been selected.
 */
function disableActions() {
  // Determine whether any rows are currently selected
  var table = document.getElementById("form1:table1");
  var disabled = (table.getAllSelectedRowsCount() > 0) ? false : true;
  // Set disabled state for top actions
  document.getElementById("form1:table1:tableActionsTop:deleteTop").setDisabled(disabled);
  // Set disabled state for bottom actions
  document.getElementById("form1:table1:tableActionsBottom:deleteBottom").setDisabled(disabled);
}]]></script>
                                <ui:tableRowGroup binding="#{variablesBalance.tableRowGroup1}"
                                    emptyDataMsg="No se han Encontrado registros que coincidan con el criterio de búsqueda." id="tableRowGroup1" rows="15"
                                    sourceData="#{variablesBalance.sct0075DataProvider}" sourceVar="currentRow">
                                    <ui:tableColumn binding="#{variablesBalance.tableColumn1}" headerText="Codigo" id="tableColumn1" sort="SCT0075.CDGOVRBLE" width="118">
                                        <ui:staticText binding="#{variablesBalance.staticText1}" id="staticText1" text="#{currentRow.value['SCT0075.CDGOVRBLE']}"/>
                                    </ui:tableColumn>
                                    <ui:tableColumn binding="#{variablesBalance.tableColumn2}" headerText="Descripción" id="tableColumn2"
                                        sort="SCT0075.DSCRPCION" width="200">
                                        <ui:staticText binding="#{variablesBalance.staticText2}" id="staticText2" text="#{currentRow.value['SCT0075.DSCRPCION']}"/>
                                    </ui:tableColumn>
                                    <ui:tableColumn binding="#{variablesBalance.tableColumn3}" headerText="Usada para:" id="tableColumn3" width="79">
                                        <ui:staticText binding="#{variablesBalance.staticText3}" id="staticText3" text="#{variablesBalance.tipoVar}"/>
                                    </ui:tableColumn>
                                    <ui:tableColumn binding="#{variablesBalance.tableColumn4}" headerText="Campo de porcentaje:" id="tableColumn4"
                                        sort="VRBLEPRCNTJE" width="232">
                                        <ui:staticText binding="#{variablesBalance.staticText4}" id="staticText4" text="#{currentRow.value['VRBLEPRCNTJE']}"/>
                                    </ui:tableColumn>
                                    <ui:tableColumn binding="#{variablesBalance.tableColumn8}" headerText="Subarea" id="tableColumn8">
                                        <ui:staticText binding="#{variablesBalance.staticText6}" id="staticText6" text="#{variablesBalance.subarea}"/>
                                    </ui:tableColumn>
                                    <ui:tableColumn binding="#{variablesBalance.tableColumn7}" headerText="Formula" id="tableColumn7" valign="middle" width="46">
                                        <ui:hyperlink action="#{variablesBalance.linkFormula_action}" binding="#{variablesBalance.linkFormula}" id="linkFormula"
                                            immediate="true" text="#{variablesBalance.formula}"/>
                                    </ui:tableColumn>
                                    <ui:tableColumn align="center" binding="#{variablesBalance.tableColumn5}" id="tableColumn5" width="77">
                                        <ui:button action="#{variablesBalance.btnModificar_action}" binding="#{variablesBalance.btnModificar}" id="btnModificar"
                                            immediate="true" mini="true" primary="true" text="Modificar"/>
                                    </ui:tableColumn>
                                    <ui:tableColumn align="center" binding="#{variablesBalance.tableColumn6}" id="tableColumn6" width="67">
                                        <ui:button action="#{variablesBalance.btnEliminar_action}" binding="#{variablesBalance.btnEliminar}" id="btnEliminar"
                                            immediate="true" mini="true" onClick="if(!confirm('¿Seguro que desea Eliminar esta Variable?')){return false;};"
                                            primary="true" text="Eliminar"/>
                                    </ui:tableColumn>
                                </ui:tableRowGroup>
                                <f:facet name="actionsTop">
                                    <ui:panelGroup binding="#{variablesBalance.groupPanel1}" id="groupPanel1" style="left: 96px; top: 96px">
                                        <ui:panelLayout binding="#{variablesBalance.layoutPanel2}" id="layoutPanel2" style="height: 24px" styleClass="">
                                            <ui:button action="#{variablesBalance.btnAgregar_action}" binding="#{variablesBalance.btnAgregar}" id="btnAgregar"
                                                immediate="true" mini="true" onClick="" primary="true" style="width: 99px" text="Agregar Variable"/>
                                            <ui:button action="#{variablesBalance.btnFiltrar_action}" binding="#{variablesBalance.btnFiltrar}" id="btnFiltrar"
                                                immediate="true" mini="true" onClick="busqueda();" primary="true" style="width: 62px" text="Buscar"/>
                                            <ui:button action="#{variablesBalance.btnGuardar_action}" binding="#{variablesBalance.btnGuardar}" disabled="true"
                                                id="btnGuardar" mini="true" primary="true" style="width: 65px" text="Guardar"/>
                                            <ui:button action="#{variablesBalance.brnCancelar_action}" binding="#{variablesBalance.brnCancelar}" disabled="true"
                                                id="brnCancelar" immediate="true" mini="true" primary="true" style="width: 65px" text="Cancelar"/>
                                        </ui:panelLayout>
                                        <ui:panelLayout binding="#{variablesBalance.layoutPanel1}" id="layoutPanel1"
                                            style="height: 55px; position: relative; width: 604px; -rave-layout: grid" visible="false">
                                            <h:panelGrid binding="#{variablesBalance.gridPanel1}" columns="5" id="gridPanel1"
                                                style="border: 1px solid rgb(204, 204, 204); top: 3px; vertical-align: middle" styleClass="Tab1Div" width="600">
                                                <ui:label binding="#{variablesBalance.label1}" for="txtCodigo" id="label1" text="Codigo"/>
                                                <ui:label binding="#{variablesBalance.label2}" for="txtDescripcion" id="label2" text="Descripcion"/>
                                                <ui:label binding="#{variablesBalance.label3}" for="dropDown2" id="label3" text="Tipo"/>
                                                <ui:label binding="#{variablesBalance.label4}" id="label4" text="Valor Porcentaje"/>
                                                <ui:label binding="#{variablesBalance.label5}" id="label5" text="Subarea"/>
                                                <ui:textField binding="#{variablesBalance.txtCodigo}" id="txtCodigo" maxLength="20"
                                                    onKeyUp="espacios(this, event)" style="width: 133px"/>
                                                <ui:textField binding="#{variablesBalance.txtDescripcion}" id="txtDescripcion" maxLength="40" style="width: 173px"/>
                                                <ui:dropDown binding="#{variablesBalance.dropDown2}" id="dropDown2" items="#{variablesBalance.listOption}" style="width: 96px"/>
                                                <ui:dropDown binding="#{variablesBalance.dropDown3}" id="dropDown3" style="width: 102px" toolTip="#{variablesBalance.sct0075DataProvider.value['SCT0075.CDGOVRBLE']}"/>
                                                <ui:dropDown binding="#{variablesBalance.dropDownSubarea}" id="dropDownSubarea"
                                                    items="#{variablesBalance.dropDownSubareaDefaultOptions.options}" selected="#{variablesBalance.dropDownSubareaDefaultOptions.selectedValue}"/>
                                            </h:panelGrid>
                                        </ui:panelLayout>
                                    </ui:panelGroup>
                                </f:facet>
                            </ui:table>
                        </h:panelGrid>
                        <ui:staticText binding="#{variablesBalance.staticText5}" id="staticText5"
                            style="color: rgb(108, 154, 154); font-family: 'Times New Roman','Times',serif; font-size: 18px; left: 267px; top: 92px; position: absolute" text="Administrador de variables de Estado Financiero"/>
                        <ui:button action="#{variablesBalance.button1_action}" binding="#{variablesBalance.button1}" id="button1" immediate="true" mini="true"
                            primary="true" style="left: 32px; top: 99px; position: absolute; width: 78px" text="Cerrar"/>
                        <ui:button action="#{variablesBalance.btnImprimir_action}" binding="#{variablesBalance.btnImprimir}" id="btnImprimir" immediate="true"
                            mini="true" primary="true" style="left: 121px; top: 99px; position: absolute; width: 108px" text="Generar reporte &gt;"/>
                        <ui:hiddenField binding="#{variablesBalance.hiddenField1}" id="hiddenField1"/>
                    </ui:form>
                </ui:body>
            </ui:html>
        </ui:page>
    </f:view>
</jsp:root>
